home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
TCL1
/
CDICTION
/
CSMARTBU.C
< prev
next >
Wrap
Text File
|
1989-09-15
|
3KB
|
100 lines
/*****************************************************************************
CSmartButton.c
see header for more information
SUPERCLASS = CButton
*****************************************************************************/
#include "CSmartButton.h"
#include "CSmartWindow.h"
/*****************************************************************************/
void CSmartButton::ISmartButton(Int16 CNTLid, CView *anEnclosure,
CBureaucrat *aSupervisor)
{
CButton::IButton( CNTLid, anEnclosure, aSupervisor);
enabled = TRUE;
SetClickCmd( GetCRefCon( macControl));
} /* CSmartButton::ISmartButton */
/*****************************************************************************/
void CSmartButton::Draw( Rect *area)
{
CSmartWindow *window;
if (GetCVariant( macControl) >= useWFont)
{
window = (CSmartWindow *) GetWRefCon( macPort);
if (member( window, CSmartWindow))
window->RestoreEnvirons();
}
inherited::Draw( area);
} /* CSmartButton::Draw */
/*****************************************************************************/
void CSmartButton::Enable( void)
{
if (!enabled)
{
enabled = TRUE;
CControl::Activate();
}
} /* CSmartButton::Enable */
/*****************************************************************************/
void CSmartButton::Disable( void)
{
if (enabled)
{
enabled = FALSE;
CControl::Deactivate();
}
} /* CSmartButton::Disable */
/*****************************************************************************/
void CSmartButton::SetEnable( Int16 enableFlag)
{
if (enableFlag) Enable(); else Disable();
} /* CSmartButton::SetEnable */
/*****************************************************************************/
void CSmartButton::Activate( void)
{
Rect tempRect;
/* don't call inherited, because it doesn't let non-rectangular
controls on non-white backgrounds draw properly */
if ((enabled)&&(ReallyVisible()))
{
if (!active) {
active = TRUE;
Prepare(); /* Tell Mac Control Manager to */
HidePen(); /* activate the control but */
HiliteControl(macControl, 0); /* suppress the automatic drawing */
ShowPen();
Refresh(); /* invalidate instead of drawing */
}
}
} /* SmartControl::Activate */
/*****************************************************************************/
void CSmartButton::Deactivate( void)
{
if ((enabled)&&(ReallyVisible())) inherited::Deactivate();
} /* CSmartButton::Deactivate */
/*****************************************************************************/
void CSmartButton::SetHilite( Int16 hiliteVal)
{
HiliteControl( macControl, hiliteVal);
} /* CSmartButton::SetHilite */
/*****************************************************************************/